package com.waves.design.observer;

/**
 * 战队成员
 * 具体观察者类
 * 在目标对象发生变化时 执行方法
 */
public class Player implements Observer {
    private String name;

    public Player(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void help(){
        System.out.println("坚持住，" + this.name + "来救你！");
    }

    public void beAttacked(AllyControlCenter acc){
        System.out.println(this.name + "被攻击！");
        acc.notifyObserver(name);
    }
}
